home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / x25 / nrs.shar.Z / nrs.shar / smail.awk < prev    next >
Encoding:
AWK Script  |  1990-04-27  |  443 b   |  24 lines

  1. #! /bin/awk -f
  2. BEGIN {
  3.     print "#reverse both"
  4.     print "#case both lower"
  5. }
  6. /^#hostname / {
  7.     myhostlen = split($2,myhost,".")
  8.     next
  9. }
  10. {    thishostlen = split($1, thishost, ".");
  11.     minlen = thishostlen-1;
  12.     if (myhostlen < minlen)
  13.         minlen = thishostlen;
  14.     for(i=1;i<=minlen;i++) {
  15.         if(myhost[i] == thishost[i]) {
  16.             for(j=i+1;j<thishostlen;j++)
  17.                 printf "%s.",thishost[j];
  18.             printf "%s:%s\n", thishost[thishostlen], $1;
  19.         }
  20.         else
  21.             break;
  22.     }
  23. }
  24.